package com.cust.cow.service.impl;

import com.cust.cow.common.CattleAddress;
import com.cust.cow.common.Result;
import com.cust.cow.mapper.BreedMapper;
import com.cust.cow.mapper.CattleMapper;
import com.cust.cow.pojo.breed;
import com.cust.cow.pojo.cattle;
import com.cust.cow.service.CattleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CattleServiceImpl implements CattleService {

    @Autowired
    public CattleMapper cattleMapper;

    @Override
    public List<cattle> findCattleAll() {
        return cattleMapper.findCattleAll();
    }

    @Override
    public cattle findCattleById(Integer cattleId) {
        return cattleMapper.findCattleById(cattleId);
    }

    @Override
    public Result insertCattle(cattle cattle) {
        cattleMapper.insertCattle(cattle);
        return new Result(200, "插入成功");
    }

    @Override
    public Result deleteCattle(Integer cattleId) {
        cattleMapper.deleteCattle(cattleId);
        return new Result(200, "删除成功");
    }

    @Override
    public List<CattleAddress> findCattleAddress() {
        return cattleMapper.findCattleAddress();
    }

    @Override
    public CattleAddress findCattleAddressById(Integer cattleId) {
        return cattleMapper.findCattleAddressById(cattleId);
    }


}
